<?php

/**
 * Created by PhpStorm.
 * User: IsSwm
 * Date: 2017/6/21
 * Time: 17:19
 */

namespace app\message\controller;

use think\Controller;
use think\Exception;
use think\Request;


class NewMessage extends Controller
{
    /**
     * @param $msg  留言的内容
     * @return \think\response\Json|\think\response\Xml
     */
    public function index($msg)
    {
//        保存消息
        $data = ['msg' => $msg];
        $res = null;
//          添加单条数据
        try {
            $res = db('msg')->insert($data);
            if ($res == 1)
                return $this->sucReturn();
        } catch (Exception $e) {
            return $this->failReturn();
        }
        
    }

}